#!/usr/bin/python
# -*- coding: utf-8 -*-

import socket
from os.path import expanduser
import sys
import os
import time
import errno
import threading
import subprocess
from socket import error as socket_error

import socket

class server:
    def __init__(self):
        self.host = "10.0.3.1"
        self.port = 3366
        self.so = socket.socket()

    def startbind(self):
        self.so.bind((self.host, self.port))
        self.so.listen(5)
        c,addr = self.so.accept()
        print('连接地址：',addr)
        t = threading.Thread(target=self.recvMsg(c),name='recv')
        t.start()
        while(True):
            value = os.stdin.realine()
            c.send(value)

    def recvMsg(self,c):
        while(True):
            msg = c.recv(1024)
            print(msg)

if __name__ == "__main__":
    a = server()
    a.startbind()